﻿using Sasa.QualityTools.CodeAnalysis.SearchEngine.Processing.Tokens;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Sasa.QualityTools.CodeAnalysis.SearchEngine.Tests.Unit.Helpers
{
    internal static class TokenGenerationExtension
    {
        internal static IEnumerable<IToken> Word(this IEnumerable<IToken> tokens, string value)
        {
            return tokens.Union(new List<IToken> { new Word { Value = value } });
        }

        internal static IEnumerable<IToken> And(this IEnumerable<IToken> tokens, string value)
        {
            return tokens.Union(new List<IToken> { new And { Value = value } });
        }

        internal static IEnumerable<IToken> Or(this IEnumerable<IToken> tokens, string value)
        {
            return tokens.Union(new List<IToken> { new Or { Value = value } });
        }

        internal static IEnumerable<IToken> LPar(this IEnumerable<IToken> tokens)
        {
            return tokens.Union(new List<IToken> { new LPar { Value = "(" } });
        }

        internal static IEnumerable<IToken> RPar(this IEnumerable<IToken> tokens)
        {
            return tokens.Union(new List<IToken> { new RPar { Value = ")" } });
        }
    }
}
